using System.ComponentModel.DataAnnotations;

namespace FServer.Core.Entities;

/// <summary>
/// 客户端版本信息
/// </summary>
public class ClientVersion
{
    public Guid Id { get; set; }
    
    /// <summary>
    /// 版本号 (如: 1.2.3)
    /// </summary>
    [Required]
    [MaxLength(20)]
    public string Version { get; set; } = string.Empty;
    
    /// <summary>
    /// 大版本号
    /// </summary>
    public int MajorVersion { get; set; }
    
    /// <summary>
    /// 中版本号
    /// </summary>
    public int MinorVersion { get; set; }
    
    /// <summary>
    /// 小版本号
    /// </summary>
    public int PatchVersion { get; set; }
    
    /// <summary>
    /// 版本类型 (Release, Beta, Alpha)
    /// </summary>
    [Required]
    [MaxLength(20)]
    public string VersionType { get; set; } = "Release";
    
    /// <summary>
    /// 是否强制更新
    /// </summary>
    public bool IsForceUpdate { get; set; } = false;
    
    /// <summary>
    /// 最低支持版本
    /// </summary>
    [MaxLength(20)]
    public string? MinSupportedVersion { get; set; }
    
    /// <summary>
    /// 版本描述
    /// </summary>
    public string? Description { get; set; }
    
    /// <summary>
    /// 更新内容
    /// </summary>
    public string? UpdateContent { get; set; }
    
    /// <summary>
    /// 下载地址
    /// </summary>
    [MaxLength(500)]
    public string? DownloadUrl { get; set; }
    
    /// <summary>
    /// 文件大小 (字节)
    /// </summary>
    public long FileSize { get; set; }
    
    /// <summary>
    /// 文件MD5校验
    /// </summary>
    [MaxLength(32)]
    public string? FileMd5 { get; set; }
    
    /// <summary>
    /// 是否启用
    /// </summary>
    public bool IsEnabled { get; set; } = true;
    
    /// <summary>
    /// 发布时间
    /// </summary>
    public DateTime ReleaseTime { get; set; } = DateTime.UtcNow;
    
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    
    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
